package me.hys.api.user;

import me.hys.api.BaseApi;
import me.hys.base.ApiResult;
import me.hys.entity.system.AccountEntity;
import me.hys.service.system.IAccountManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Author: @author HYS . <br>
 * Date: 2015-9-26 下午8:16:40 . <br>
 * Function: 第三方账号相关
 */
@Controller
@RequestMapping("/api/user")
public class AccountApi extends BaseApi {
	@Autowired
	private IAccountManager accountManager;

	/**
	 * @Title : accountCheck
	 * @Description : 检查第三方账户是否绑定手机号
	 */
	@ResponseBody
	@RequestMapping(value = "/account_check", method = RequestMethod.POST)
	public ApiResult accountCheck(@RequestParam String uid) {
		return accountManager.checkAccount(uid);
	}

	/**
	 * @Title : accountConn
	 * @Description : 账户绑定
	 */
	@ResponseBody
	@RequestMapping(value = "/account_conn", method = RequestMethod.POST)
	public ApiResult accountConn(@ModelAttribute AccountEntity entity) {
		return accountManager.saveAccount(entity);
	}
}
